       IDENTIFICATION DIVISION.
       PROGRAM-ID. ClientesLib.
       AUTHOR. Grupo 5. 2do cuatrimestre 2011.
       
       ENVIRONMENT DIVISION.
         INPUT-OUTPUT SECTION.
           FILE-CONTROL.
             SELECT CLI-ARCH ASSIGN TO "CLIENTES.IDX"
                 ORGANIZATION IS INDEXED
                 ACCESS MODE IS DYNAMIC
                 RECORD KEY IS CLI-COD-CLI
                 ALTERNATE RECORD KEY IS CLI-CUIT
                 FILE STATUS IS CLI-STATUS.

       DATA DIVISION.
         FILE SECTION.
           COPY "Clientes-FD.cbl".

         WORKING-STORAGE SECTION.
           01 CLI-STATUS           PIC X(02).

         LINKAGE SECTION.
           01 OPERACION            PIC 9(01).
           01 REG                  PIC X(81).
           01 FS                   PIC X(02).

       PROCEDURE DIVISION USING OPERACION, REG, FS.
         IF OPERACION = 0
             OPEN INPUT CLI-ARCH
         END-IF

         IF OPERACION = 1
             MOVE REG TO CLI-REG
             
             READ CLI-ARCH RECORD
             
             IF CLI-STATUS = "00"
                 MOVE CLI-REG TO REG
             END-IF
         END-IF

         IF OPERACION = 2
             MOVE REG TO CLI-REG
             
             READ CLI-ARCH RECORD
                 KEY IS CLI-CUIT
             
             IF CLI-STATUS = "00"
                 MOVE CLI-REG TO REG
             END-IF
         END-IF

         IF OPERACION = 3
             CLOSE CLI-ARCH
         END-IF

         MOVE CLI-STATUS TO FS

         EXIT PROGRAM
         .
